﻿using BLL;
using Microsoft.AspNetCore.Mvc;

namespace TiboShop.ViewComponents
{
    public class HeadViewComponent:ViewComponent
    {
        private readonly BLLUser bllUser;
        private readonly ISession _session;
        private readonly IHttpContextAccessor _contextAccessor;
        public HeadViewComponent(BLLUser bllUser, IHttpContextAccessor httpContext)
        {
            _contextAccessor = httpContext;
            this._session = _contextAccessor.HttpContext!.Session;
            this.bllUser = bllUser;
        }
        //执行调用视图组件
        public IViewComponentResult Invoke()
        {
            
            bool state = true;
            int uid = Convert.ToInt32(_session.GetInt32("URID"));
            if(uid==2||uid==3)
            {
                return View(state);
            }
            else
            {
                state = false;
                return View(state);
            }
        }
    }
}
